package com.feeyin.radar.commons;

public class StringUtils
{
  public static boolean isEmpty(String text)
  {
    return (text == null) || ("".equals(text));
  }

  public static String getSubLastComma(String str)
  {
    if (isEmpty(str)) return null;
    int length = str.length();
    int lastSignIndex = str.lastIndexOf(",");
    if (lastSignIndex != length - 1) return str;
    return str.substring(0, lastSignIndex);
  }

  public static String getStringIdsByIntegerArray(Integer[] ids)
  {
    if ((ids == null) || (ids.length <= 0)) return null;
    String stringIds = "";
    for (int i = 0; i < ids.length; i++) {
      if (i < ids.length - 1)
        stringIds = stringIds + ids[i] + ",";
      else {
        stringIds = stringIds + ids[i];
      }
    }
    return stringIds;
  }
}